Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

prevent net/url encoding the user password #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RyanDeng
Copy link

@RyanDeng RyanDeng commented Dec 19, 2017

According to net/url

// A URL represents a parsed URL (technically, a URI reference).
//
// The general form represented is:
//
//	[scheme:][//[userinfo@]host][/]path[?query][#fragment]
//
// URLs that do not start with a slash after the scheme are interpreted as:
//
//	scheme:opaque[?query][#fragment]
//

If the url starts with a slash after the scheme, the url.String() func will do url encode for the userinfo. In this case, password that has non-alphanumeric char will be url encoded and mysql auth will fail.

Probably the best fix should be in Open() func of database/driver.go. However I'm using mysql and not familiar with other drivers, so make a tiny fix in the mysql driver

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant